package twitter4j;

import java.rmi.RemoteException;

import twitter4j.auth.AccessToken;


public class TwitterUtil {

	private String consumerKey;
	private String consumerSecret;
	private String twitterToken;
	private String twitterTokenSecret;
	
	public TwitterUtil(){
		this.setConsumerKey("RETUwvg7Aks1mnpJOX91tA");
		this.setConsumerSecret("k2yfxIHV3t64hDJFhGhFseJ7Sq7xOY9cc6bqgKUFo");
		this.setTwitterToken("17400575-zryGI6tL5fdpUm7QNvP4hARAThaDOLAZMkh2cZoj7");
		this.setTwitterTokenSecret("yzNXsArtQRQL8agDRlNcew2WnVzjDJpWvE06XZCFHFo");
	}
	
	public void enviarMensagem(String msg) throws TwitterException, RemoteException, Exception{  
		Twitter twitter = new TwitterFactory().getInstance();
		twitter.setOAuthConsumer(this.getConsumerKey(), this.getConsumerSecret());
		AccessToken accessToken = new AccessToken(this.getTwitterToken(), this.getTwitterTokenSecret());
		twitter.setOAuthAccessToken(accessToken); 
		twitter.updateStatus(msg);
/*		ResponseList<DirectMessage>direct = twitter.getDirectMessages();
		System.out.println("opa");
		for(int i=0; i<direct.size(); i++){
			System.out.println(direct.get(i).getText());
		}*/
		
	}

	public String getConsumerKey() {
		return consumerKey;
	}

	public void setConsumerKey(String consumerKey) {
		this.consumerKey = consumerKey;
	}

	public String getConsumerSecret() {
		return consumerSecret;
	}

	public void setConsumerSecret(String consumerSecret) {
		this.consumerSecret = consumerSecret;
	}

	public String getTwitterToken() {
		return twitterToken;
	}

	public void setTwitterToken(String twitterToken) {
		this.twitterToken = twitterToken;
	}

	public String getTwitterTokenSecret() {
		return twitterTokenSecret;
	}

	public void setTwitterTokenSecret(String twitterTokenSecret) {
		this.twitterTokenSecret = twitterTokenSecret;
	}  
	  
}